package com.it.you.service.pay;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 常规的 if...else...判断
 */
@Service
public class PayService {

    @Autowired
    private AliaPay aliaPay;
    @Autowired
    private WeiXinPay weiXinPay;
    @Autowired
    private JingDongPay jingDongPay;


    public String toPay(String code) {
        if ("alia".equals(code)) {
            return aliaPay.pay();
        } else if ("weixin".equals(code)) {
            return weiXinPay.pay();
        } else if ("jingdong".equals(code)) {
            return jingDongPay.pay();
        } else {
            return "找不到支付方式";
        }
    }

}
